package 线程池;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class 创建可缓存的线程池 {
    public static void main(String[] args) throws Exception{
        ExecutorService executorService = Executors.newCachedThreadPool();
        executorService.submit(() -> {
            System.out.println(Thread.currentThread().getName());
        });
        //Thread.sleep(1000);
        executorService.submit(() -> {
            System.out.println(Thread.currentThread().getName());
        });
        executorService.shutdown();
    }
}
